home *** CD-ROM | disk | FTP | other *** search
- Path: jupiter.planet.net!usenet
- From: cygnusx@planet.net (David )
- Newsgroups: comp.lang.c
- Subject: HELP : Assignment with strings and pointers.
- Date: Tue, 09 Apr 1996 20:24:44 GMT
- Organization: Planet Access Networks - Stanhope, NJ
- Message-ID: <316ac5b5.4283622@news.planet.net>
- NNTP-Posting-Host: newt10.planet.net
- X-Newsreader: Forte Agent .99d/32.182
-
-
-
- This program is probably idiotic since I am in a (intro to C ) class
- but it does work. I was wondering if anyone had a better idea for this
- type of situation. I could not find an actual function in the
- character handling library for this? does one exist ? i would like to
- make a separate function in the main to handle this task? Is it
- possible?
-
- thanx David
-
-
- #include <stdio.h>
- #include <ctype.h>
-
- /* this program determines if the first word is the second word
- spelled backwords and have only included 3 characters for
- simplification . inputs have been left out for clarity */
-
- main()
- {
-
- char *ptr = "six";
- char *atr = "xis";
-
- printf("%s\n",ptr);
-
- printf("%s\n",atr);
-
- if (*ptr==*(atr+2)&&*(ptr+1)==*(atr+1)&&*(ptr+2)==*atr)
- printf("okay");
-
- else printf("no good");
- return 0; }
-